/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package system;

import exemple.ClientRMI;
import exemple.HistoricSystem;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PUT;
import javax.ws.rs.core.MediaType;

/**
 * REST Web Service
 *
 * @author killian
 */
@Path("systemInformations")
public class SystemInformationsResource {

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of SystemInformationsResource
     */
    public SystemInformationsResource() {
    }

    /**
     * Retrieves representation of an instance of system.SystemInformationsResource
     * @return an instance of java.lang.String
     */
    @GET
    @Produces("application/xml")
    public String getXml() {
        //TODO return proper representation object
        throw new UnsupportedOperationException();
    }
    
    @GET
    @Path("getSystemInfo/{ip}")
    @Produces({MediaType.APPLICATION_XML})
    public HistoricSystem getSystemInfo(@PathParam("id") String ipAddress) {
        HistoricSystem hi;
        hi = ClientRMI.getSystemInformations(ipAddress);
        System.out.println(hi);
        // -Djava.rmi.server.hostname=147.171.79.84
        //-D java.rmi.server.codebase=http://localhost:8080/TestRMI/Ressources/RmiServeur.jar
        return hi;
    }

    /**
     * PUT method for updating or creating an instance of SystemInformationsResource
     * @param content representation for the resource
     * @return an HTTP response with content of the updated or created resource.
     */
    @PUT
    @Consumes("application/xml")
    public void putXml(String content) {
    }
}
